/*
 * main.cpp
 */

#include <chrono>
#include <iostream>
#include <memory>
#include <thread>
#include "UBus.h"

int main(int argc, char *argv[])
{

    std::shared_ptr<UBus> bus = std::make_shared<UBus>();
    bus->Connect();
    bus->Objects();

    bus->Subscribe("huhu", [&](json data) { std::cout << "Listen: " << data.dump(4) << std::endl; });

    std::this_thread::sleep_for(std::chrono::seconds(5));
    bus->unSubscribe("huhu", [&](json data) { std::cout << "Listen: " << data.dump(4) << std::endl; });


    while(1);
    bus->Disconnect();
    std::cout << "Leaving..." << std::endl;

    return 0;
}
